import request from "./http";

// 获取所有的任务
export const reqGetSpiderTasks = (params={}) => {
  return request({
    url: '/tasks/spider/list/',
    method: 'get',
    params
  })
}

// 创建一个任务
export const reqCreateSpiderTask = (data) => {
  return request({
    url: '/tasks/spider',
    method: 'post',
    data
  })
}

// 删除任务（含批量）
export const reqDeleteSpiderTask = (data) => {
  return request({
    url: '/tasks/spider',
    method: 'delete',
    data
  })
}

// 查看任务
export const reqGetSpiderTask = (id) => {
  return request({
    url: '/tasks/spider/' + id,
    method: 'get',
  })
}

// 更新任务
export const reqUpdateSpiderTask = (data) => {
  return request({
    url: '/tasks/spider/',
    method: 'put',
    data
  })
}

// 运行任务
export const reqRunSpiderTask = (data) => {
  return request({
    url: '/tasks/spider/run',
    method: 'post',
    data
  })
}
